<template>
  <div class="app-container">
    <eHeader :param-bean="paramBean" :sup_this="sup_this" />
    <eForm ref="form" :sup_this="sup_this" />
    <PrintPageForm ref="PrintPageForm" :sup_this="sup_this" :print-url="printUrl" report-code="order_detail_print" />
    <!--表格渲染-->
    <DataGridTable
      v-loading="loading"
      ref="mainTable"
      :sup_this="sup_this"
      :max-height="gridMaxHeight"
      :data="data.rtnList"
      :total="total"
      :show-cell-class="true"
      :all-define-columns="['busCpyName','busDate','otherStateName','busUserName','totalQty','totalMoney','totalTax','taxRate','priceCur','invoiceType','orderStatus','busRmk','lastUpdateDate']"
      custom-cell-field-column="otherState"
      custom-cell-class-column="otherStateName"
      grid-id="orderOtherMngProcessGridId"
      @selection-change="handleGridSelectionChange">
      <DataGridColumnSlot prop="sysGenCode" label="业务类型">
        <template slot-scope="scope">
          <edit :data="scope.row" :sup_this="sup_this" />
        </template>
      </DataGridColumnSlot>
      <DataGridColumn slot="busCpyName" prop="busCpyName" label="供应商"/>
      <DataGridColumnSlot slot="busDate" prop="busDate" label="业务时间" >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.busDate) }}</span>
        </template>
      </DataGridColumnSlot>
      <DataGridColumn slot="otherStateName" prop="otherStateName" label="反馈状态"/>
      <DataGridColumn slot="busUserName" prop="busUserName" label="用户"/>
      <DataGridColumn slot="totalQty" prop="totalQty" label="总数量" />
      <DataGridColumn v-permission="['SYS_ADMIN','COMMON_ADMIN','SALE_ORDER_ALL','SALE_ORDER_PRICE']" slot="totalMoney" prop="totalMoney" label="本位币金额" />
      <DataGridColumn v-permission="['SYS_ADMIN','COMMON_ADMIN','SALE_ORDER_ALL','SALE_ORDER_PRICE']" slot="totalTax" prop="totalTax" label="本位币税额" />
      <DataGridColumn slot="taxRate" prop="taxRate" label="税率" />
      <DataGridColumnSlot slot="priceCur" prop="priceCur" label="本位币">
        <template slot-scope="scope">
          <template v-for="item in dicts.bus_price_cur">
            <span v-if="scope.row.priceCur === item.dictCode" :key="item.id" >{{ item.dictName }}</span>
          </template>
        </template>
      </DataGridColumnSlot>
      <DataGridColumnSlot slot="invoiceType" prop="invoiceType" label="发票类型">
        <template slot-scope="scope">
          <template v-for="item in dicts.bus_invoice_type">
            <span v-if="scope.row.invoiceType === item.dictCode" :key="item.id" >{{ item.dictName }}</span>
          </template>
        </template>
      </DataGridColumnSlot>
      <DataGridColumn slot="busRmk" prop="busRmk" label="备注"/>
      <DataGridColumnSlot slot="lastUpdateDate" prop="lastUpdateDate" label="最后更新时间">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastUpdateDate) }}</span>
        </template>
      </DataGridColumnSlot>
    </DataGridTable>
  </div>
</template>

<script>
import { parseTime } from '@/utils/index'
import eHeader from './module/otherHeader'
import edit from './module/edit'
import eForm from './module/otherForm'
import initData from '@/mixins/initData'
import order from '@/api/business/Order'
import PrintPageForm from '@/views/components/PrintPageForm'

export default {
  components: { eHeader, eForm, edit, PrintPageForm },
  dictTypes: ['bus_price_cur', 'bus_invoice_type', 'bus_order_status'],
  mixins: [initData],
  props: {
  },
  data() {
    return {
      delLoading: false,
      sup_this: this,
      printUrl: order.printUrl()
    }
  },
  created() {
    this.url = order.loadOtherDataUrl()
    this.defaultParamBean.otherStateList = ['8'] // 默认加载待反馈的数据
    if (this.$route.query.sysGenCode) {
      this.paramBean.sysGenCode = this.$route.query.sysGenCode
    }
    this.$nextTick(() => {
      this.init()
    })
  },
  mounted() {
  },
  methods: {
    parseTime,
    async beforeInit() {
      return true
    }
  }
}
</script>
